package com.sh.service.user;

import com.sh.common.BaseResult;
import com.sh.common.exception.BizException;
import com.sh.entity.ObjectItem;
import com.sh.pojo.bo.CopyObjectsBO;
import com.sh.pojo.bo.DeleteObjectBO;
import com.sh.pojo.bo.SearchObjectBO;
import com.sh.pojo.vo.DownLoadObjectVO;
import org.springframework.core.io.InputStreamResource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.multipart.MultipartFile;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.zip.ZipOutputStream;

public interface IUserResourceService {

    List<String> listUserBuckets();

    List<String> listUserFirstFolders(String bucket);

    List<ObjectItem> searchObjects(SearchObjectBO bo) throws BizException;

    /**
     * 下载、复制URL
     */
    String getDownloadUrl(String bucket, String objNm);

    /**
     * 上传文件
     */
    void uploadObject(MultipartFile file, String bucket, String path, String objectName) throws BizException;

    /**
     * 上传文件夹
     * */

    /**
     * 新建文件夹
     */
    void createFolder(String bucket, String path, String folderName) throws BizException;

    /**
     * 下载、复制URL
     * */


    /**
     * 删除
     */
    void deleteObject(String bucket, String path, String objectName) throws BizException;

    void deleteFolder(String bucket, String path) throws BizException;

    void deleteObjects(String bucket, List<String> objectKeys) throws BizException;

    /**
     * 批量删除
     */


    void renameFolder(String bucket, String path, String sourceName, String targetName) throws BizException;

    void renameObject(String bucket, String path, String sourceName, String targetName) throws BizException;

    void copyObject(String bucket, String path, String objectName, String targetObjectName) throws BizException;

    void copyObjects(CopyObjectsBO copyObjectsBO);

    void uploadFolder(String bucket, String path, List<MultipartFile> files) throws BizException;

    List<DownLoadObjectVO> downloadObjects(String bucket, List<String> objectKeys, Integer expire, String downloadPath) throws BizException;


    ByteArrayOutputStream downloadAndZipFiles(String bucket, List<String> paths) throws IOException;
}
